<template>
  <div class="div">
    <a-modal
      title="选择居民用户"
      :width="modalWidth"
      :visible="visible"
      :confirmLoading="confirmLoading"
      @ok="handleCancel"
      @cancel="handleCancel"
    >
      <a-spin tip="Loading..." :spinning="false">
        <a-table :columns="columns" :data-source="data">
          <span slot="action" slot-scope="text, record">
            <a @click="add(record)">选择</a>
          </span>
        </a-table>
      </a-spin>
    </a-modal>
  </div>
</template>

<script>
import { gkakRJianKangXinXiData } from '@/api/api'
export default {
  name: 'JSelectDepartModal',
  props: ['modalWidth', 'multi', 'rootOpened', 'departId'],
  data() {
    return {
      visible: false,
      confirmLoading: false,
      // treeData: [],
      // autoExpandParent: true,
      // expandedKeys: [],
      // dataList: [],
      // checkedKeys: [],
      // checkedRows: [],
      // searchValue: '',
      data: [],
       columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '姓名',
          align: 'center',
          dataIndex: 'xingMing'
        },
        {
          title: '身份证号',
          align: 'center',
          dataIndex: 'shenFenZhengHao'
        },
        {
          title: '民族',
          align: 'center',
          dataIndex: 'minZu_dictText'
        },
        {
          title: '籍贯',
          align: 'center',
          dataIndex: 'jiGuan'
        },
        {
          title: '紧急联系人姓名',
          align: 'center',
          dataIndex: 'jinJiLianXiRenXingMing'
        },
        {
          title: '紧急联系人电话',
          align: 'center',
          dataIndex: 'jinJiLianXiRenDianHua'
        },
        {
          title: '慢性病种类',
          align: 'center',
          dataIndex: 'manXingBingZhongLei_dictText'
        },
        {
          title: '居住地址',
          align: 'center',
          dataIndex: 'juZhuDiZhi'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
    }
  },
  created() {
    this.loadDepart()
  },
  watch: {
   
  },
  methods: {
    show() {
      this.visible = true
     
    },
    loadDepart() {
      gkakRJianKangXinXiData().then((res) => {
        
        if (res.success) {
          this.data = res.result.records
        
        }
      })
    },

    handleCancel() {
      this.visible = false
    },
  
    // 选择产品
    add(val){
      
      console.log(val.id)
        this.$emit('ok', val)
        this.visible = false
    }
  },
}
</script>

<style scoped>
.ant-modal-wrap >>> .ant-modal {
  width: 1200px !important;
}
</style>